export interface RouteConfig {
  id: string
  title: string
  description: string
  category: string
  tags: string[]
  difficulty?: 'easy' | 'medium' | 'hard'
  type: 'hook' | 'interview'
  contentFile: string
  practiceFile?: string
}

export const routes: RouteConfig[] = [
  // Hook 路由
  {
    id: 'useLocalStorage',
    title: 'useLocalStorage',
    description: '一个用于管理localStorage的React Hook',
    category: 'storage',
    tags: ['localStorage', '状态管理'],
    type: 'hook',
    contentFile: 'hooks/useLocalStorage.ts',
    practiceFile: 'hooks/useLocalStorage.practice.ts'
  },
  {
    id: 'useDebounce',
    title: 'useDebounce',
    description: '防抖Hook，用于延迟执行函数',
    category: 'performance',
    tags: ['防抖', '性能优化'],
    type: 'hook',
    contentFile: 'hooks/useDebounce.ts',
    practiceFile: 'hooks/useDebounce.practice.ts'
  },
  {
    id: 'useLock',
    title: 'useLock',
    description: '防止异步函数重复执行的Hook',
    category: 'performance',
    tags: ['防重复', '异步控制', '性能优化'],
    type: 'hook',
    contentFile: 'hooks/useLock.ts',
    practiceFile: 'hooks/useLock.practice.ts'
  },

  // 面试题路由
  {
    id: 'debounce',
    title: '手写防抖函数',
    description: '实现一个防抖函数，用于限制函数的执行频率',
    category: 'javascript',
    difficulty: 'medium',
    tags: ['防抖', '函数', '性能优化'],
    type: 'interview',
    contentFile: 'interviews/debounce.ts',
    practiceFile: 'interviews/debounce.practice.ts'
  },
  {
    id: 'throttle',
    title: '手写节流函数',
    description: '实现一个节流函数，用于控制函数的执行频率',
    category: 'javascript',
    difficulty: 'medium',
    tags: ['节流', '函数', '性能优化'],
    type: 'interview',
    contentFile: 'interviews/throttle.ts',
    practiceFile: 'interviews/throttle.practice.ts'
  }
]

// 获取Hook路由
export const getHookRoutes = (): RouteConfig[] => {
  return routes.filter(route => route.type === 'hook')
}

// 获取面试题路由
export const getInterviewRoutes = (): RouteConfig[] => {
  return routes.filter(route => route.type === 'interview')
}

// 根据ID获取路由
export const getRouteById = (id: string): RouteConfig | undefined => {
  return routes.find(route => route.id === id)
}
